package com.hn658.user.itf;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import com.hn658.user.itf.vo.AppInfoResponse;
import com.hn658.user.itf.vo.QueryUserInfoDTO;
import com.hn658.user.itf.vo.UserInfoResponse;


@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class,DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = { "classpath:service-client.xml" })
public class ItfServiceClient {
	
	@Resource(name="itfAppservice")
	private ItfAppInfoService appInfoService;
	
	@Resource(name="itfUserservice")
	private ItfUserService itfUserservice;

//	@Test
	public void userServiceFindUserById() {
		UserInfoResponse result = itfUserservice.findUserById(900000129L);
		String loginAccount = result.getUserInfo().getLoginAccount();
		System.out.println(loginAccount);
	}
	
//	@Test
	public void testServiceQueryAppUser(){
		Map<String,Object> queryMap  = new HashMap<String,Object> ();
//		queryMap.put("appId", 100000);
		String appId ="b45cebdf032d4f03b3a3f09066ca9f83";
		UserInfoResponse result = itfUserservice.queryAppUser(queryMap,appId, 10, 0, "create_time", true);
		int size = result.getUserInfoList().size();
		System.out.println(size);
	}
	
	
//	@Test
	public void userServiceFindUserByLoginAccount() {
		UserInfoResponse result = itfUserservice.findUserByLoginAccount("admin@admin.com");
		String loginAccount = result.getUserInfo().getLoginAccount();
		System.out.println(loginAccount);
	}
	
//	@Test
	public void appServiceFindAppInfoByAppId() {
		AppInfoResponse result = appInfoService.findAppInfoByAppId("aaaaa");
		String appId = result.getAppInfo().getAppId();
		System.out.println(appId);
	}

}
